package cn.xo68.metadata.service;

import lombok.extern.slf4j.Slf4j;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.xo68.metadata.entity.MetadataColumn;
import cn.xo68.metadata.mapper.MetadataColumnMapper;



/** 
 * MetadataColumn Service
 * @author wuyy(16349023@qq.com)
 * @date 2020年03月12日 11:44:16
 *
 */
@Slf4j
@Service
public class MetadataColumnService{
    
    @Autowired
    private MetadataColumnMapper metadataColumnMapper;

    public MetadataColumn find(Integer columnId) {
        return  metadataColumnMapper.find(columnId);
    }

    public MetadataColumn insert(MetadataColumn metadataColumn) {
        metadataColumnMapper.insert(metadataColumn);
        return metadataColumn;
    }

    public MetadataColumn update(MetadataColumn metadataColumn) {
        metadataColumnMapper.update(metadataColumn);
        return metadataColumn;
    }
    
    public int delete(Integer columnId) {
        return metadataColumnMapper.delete(columnId);
    }
    
    public List<MetadataColumn> list() {
        return metadataColumnMapper.list();
    }
	
	public PageInfo<MetadataColumn> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<MetadataColumn> docs = metadataColumnMapper.list();
        PageInfo<MetadataColumn> pageInfo = new PageInfo<MetadataColumn>(docs);
        return pageInfo;
    }
}